Skip to content

[lldb][test] Move std::unordered_map::iterator from libcxx to generic… #147703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Michael137
Copy link
Member

… directory

This just moves the test from libcxx to generic. There are currently no std::unordered_map::iterator formatters for libstdc++ so I didn't add a test-case for it.

Split out from #146740

@Michael137 Michael137 requested a review from labath July 9, 2025 11:34
@Michael137 Michael137 requested a review from JDevlieghere as a code owner July 9, 2025 11:34
@llvmbot llvmbot added the lldb label Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

… directory

This just moves the test from libcxx to generic. There are currently no std::unordered_map::iterator formatters for libstdc++ so I didn't add a test-case for it.

Split out from #146740


Full diff: https://github.com/llvm/llvm-project/pull/147703.diff

3 Files Affected:

  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile (-3)
  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py (+17-10)
  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp ()
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile
similarity index 54%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile
index 564cbada74e08..99998b20bcb05 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile
@@ -1,6 +1,3 @@
 CXX_SOURCES := main.cpp
 
-USE_LIBCPP := 1
-
-CXXFLAGS_EXTRAS := -O0
 include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
similarity index 92%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
index a338e3c12598e..d2382373f4810 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
@@ -8,7 +8,7 @@
 from lldbsuite.test import lldbutil
 
 
-class LibcxxUnorderedMapDataFormatterTestCase(TestBase):
+class StdUnorderedMapDataFormatterTestCase(TestBase):
     def check_ptr_or_ref(self, var_name: str):
         var = self.frame().FindVariable(var_name)
         self.assertTrue(var)
@@ -32,12 +32,10 @@ def check_ptr_ptr(self, var_name: str):
         self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"')
         self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"')
 
-    @add_test_categories(["libc++"])
-    def test_iterator_formatters(self):
+    def do_test(self):
         """Test that std::unordered_map related structures are formatted correctly when printed.
         Currently only tests format of std::unordered_map iterators.
         """
-        self.build()
         (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
             self, "Break here", lldb.SBFileSpec("main.cpp", False)
         )
@@ -105,13 +103,12 @@ def test_iterator_formatters(self):
             type="const StringMapT *const &",
         )
 
-    @expectedFailureAll(
-        bugnumber="https://github.com/llvm/llvm-project/issues/146040",
-        compiler="clang",
-        compiler_version=["<", "21"],
-    )
     @add_test_categories(["libc++"])
-    def test_ptr_formatters(self):
+    def test_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test()
+
+    def do_test_ptr(self):
         """
         Test that pointers to std::unordered_map are formatted correctly.
         """
@@ -127,3 +124,13 @@ def test_ptr_formatters(self):
         self.check_ptr_ptr("ptr4")
         self.check_ptr_ptr("ptr5")
         self.check_ptr_ptr("ptr6")
+
+    @expectedFailureAll(
+        bugnumber="https://github.com/llvm/llvm-project/issues/146040",
+        compiler="clang",
+        compiler_version=["<", "21"],
+    )
+    @add_test_categories(["libc++"])
+    def test_ptr_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test_ptr()
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp
similarity index 100%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp

@Michael137 Michael137 merged commit ba6f872 into llvm:main Jul 9, 2025
11 checks passed
@Michael137 Michael137 deleted the lldb/consolidate-stl-tests-unordered_map-iterator branch July 9, 2025 11:57
… directory

This just moves the test from `libcxx` to `generic`. There are currently no `std::unordered_map::iterator` formatters for libstdc++ so I didn't add a test-case for it.

Split out from llvm#146740
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants